
FROM ubuntu

ADD resources/sources.list /etc/apt/
ADD resources/pip.conf ~/.pip/

# set work directory
WORKDIR /code

# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# copy requirements file
COPY ./requirements.txt /code/requirements.txt

# install dependencies
RUN set -eux \
    && apt update \
#&& rm /usr/bin/python3 \
    && apt install python3.8 -y \
    && ln -s /usr/bin/python3.8 /usr/bin/python3 \
    && apt install netcat libmysqlclient-dev python3-pip -y \
    && python3 -m pip install -i  https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip \
    && pip install -i  https://pypi.tuna.tsinghua.edu.cn/simple -r /code/requirements.txt 
#    && mv /usr/lib/python3.6/configparser.py /usr/lib/python3.6/ConfigParser.py 

# copy project
COPY . /code
RUN chmod +x ./scripts/wait-for-db.sh
EXPOSE 8080

